<?
include_once (dirname(__FILE__) . '/libs/database/db.php');
require_once ("libs/JSON.php");

function pre($str) {
	if ($str == null)
		$str = "";

	$str = htmlspecialchars_decode($str);

	return $str;
}

// create a new instance of Services_JSON
$json = new Services_JSON();

$pid = $_POST[pid];
$sql = "SELECT * FROM " . TB_EVENT . " WHERE ID=$pid";
$result = mysql_query($sql);

$row = mysql_fetch_array($result);
$data = array (
	"ID" => pre($row['ID']
), "OWNER" => pre($row['OWNER']), "TITLE" => pre($row['TITLE']), "START_TIME" => pre($row['START']), "END_TIME" => pre($row['END']), "IMAGE" => pre($row['IMAGE']), "COLOR" => pre($row['COLOR']), "TAPE_IMAGE" => pre($row['TAPE_IMAGE']), "ICON" => pre($row['ICON']), "IS_DURATION" => pre($row['IS_DURATION']), "COMPLETE" => pre($row['COMPLETE']), "PAGE_URL" => pre($row['PAGE_URL']), "TITLE_LINK" => pre($row['TITLE_LINK']), "PRJ_ID" => pre($row['PRJ_ID']), "PRIORITY" => pre($row['PRIORITY']), "DESCRIPTION" => pre($row['DESCRIPTION']));

$json = new Services_JSON();
echo $json->encode($data);
?>
